home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / LINUX / INIT.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  2KB  |  69 lines

  1. #ifndef _LINUX_INIT_H
  2. #define _LINUX_INIT_H
  3.  
  4. /* These macros are used to mark some functions or 
  5.  * initialized data (doesn't apply to uninitialized data)
  6.  * as `initialization' functions. The kernel can take this
  7.  * as hint that the function is used only during the initialization
  8.  * phase and free up used memory resources after
  9.  *
  10.  * Usage:
  11.  * For functions:
  12.  * 
  13.  * You should add __init immediately before the function name, like:
  14.  *
  15.  * static void __init initme(int x, int y)
  16.  * {
  17.  *    extern int z; z = x * y;
  18.  * }
  19.  *
  20.  * Depricated: you can surround the whole function declaration 
  21.  * just before function body into __initfunc() macro, like:
  22.  *
  23.  * __initfunc (static void initme(int x, int y))
  24.  * {
  25.  *    extern int z; z = x * y;
  26.  * }
  27.  *
  28.  * If the function has a prototype somewhere, you can also add
  29.  * __init between closing brace of the prototype and semicolon:
  30.  *
  31.  * extern int initialize_foobar_device(int, int, int) __init;
  32.  *
  33.  * For initialized data:
  34.  * You should insert __initdata between the variable name and equal
  35.  * sign followed by value, e.g.:
  36.  *
  37.  * static int init_variable __initdata = 0;
  38.  * static char linux_logo[] __initdata = { 0x32, 0x36, ... };
  39.  *
  40.  * For initialized data not at file scope, i.e. within a function,
  41.  * you should use __initlocaldata instead, due to a bug in GCC 2.7.
  42.  */
  43.  
  44. /*
  45.  * Disable the __initfunc macros if a file that is a part of a
  46.  * module attempts to use them. We do not want to interfere
  47.  * with module linking.
  48.  */
  49.  
  50. #ifndef MODULE
  51. #include <asm/init.h>
  52. #else
  53. #define __init
  54. #define __initdata
  55. #define __initfunc(__arginit) __arginit
  56. /* For assembly routines */
  57. #define __INIT
  58. #define __FINIT
  59. #define __INITDATA
  60. #endif
  61.  
  62. #if __GNUC__ >= 2 && __GNUC_MINOR__ >= 8
  63. #define __initlocaldata  __initdata
  64. #else
  65. #define __initlocaldata
  66. #endif
  67.  
  68. #endif
  69.